Public Class DaGiac
    'thuoc tinh
    Protected aDiem As New List(Of Diem)
    'property
    Property _aDiem() As List(Of Diem)
        Get
            Return Me.aDiem
        End Get
        Set(ByVal value As List(Of Diem))
            Me.aDiem = value
        End Set
    End Property
    'nhap
    Public Shared Function Nhap() As DaGiac
        Dim dg As New DaGiac()
        Dim n As Integer
        Console.Write("nhap n: ")
        n = Integer.Parse(Console.ReadLine())
        For i As Integer = 0 To n - 1
            Dim p As New Diem
            p = Diem.Nhap("Nhap==diem :")
            dg.aDiem.Add(p)
        Next
        Return dg
    End Function
    'chu vi da giac
    Public Function ChuVi() As Double
        Dim cv As Double = 0
        For i As Integer = 0 To Me.aDiem.Count - 2
            cv = cv + Me.aDiem(i).KhoangCach(aDiem(i + 1))
        Next
        cv = cv + Me.aDiem(Me.aDiem.Count - 1).KhoangCach(aDiem(0))
        Return cv
    End Function

End Class
